const { ccclass, property } = cc._decorator;

@ccclass
export default class VProgress extends cc.ProgressBar {
    @property(cc.Label)
    lb: cc.Label = null;
    @property(cc.Sprite)
    white: cc.Sprite = null;

    @property
    max = 0;
    @property
    fixed = 0;

    _updateBarStatus() {
        //@ts-ignore
        super._updateBarStatus();
        this.lb.string = `${(this.progress * this.max).toFixed(this.fixed)} / ${this.max}`;

        //增量白
        cc.Tween.stopAllByTarget(this.white);
        let dis = this.white.fillRange - this.barSprite.fillRange;
        if (dis < 0) {
            this.white.fillRange = this.barSprite.fillRange
        }
        else {
            cc.tween(this.white).to(dis, { fillRange: this.barSprite.fillRange }, { easing: "sineIn" }).start();
        }

    }
}